import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:speed_random/app_styles.dart';
import 'package:speed_random/common/common_fuc.dart';
import 'package:speed_random/pages/home/rand_com/com_results/view.dart';
import 'package:speed_random/pages/home/rand_com/view_set.dart';
import 'package:speed_random/widgets/row_two_buttons.dart';

import 'logic.dart';
import 'state.dart';


class ViewBodyRps extends StatelessWidget {

  final RandComLogic logic;
  final RandComState state;

  const ViewBodyRps({Key? key, required this.logic, required this.state}) : super(key: key);




    // ... 已有代码 ...

@override
Widget build(BuildContext context) {
  return Obx(() => Card(
    color: state.randComArgs.value.colorPagebg,
    child: Center( // 添加Center组件确保整体居中
      child: SingleChildScrollView( // 替换ListView为SingleChildScrollView
       // padding: EdgeInsets.all(16), // 添加内边距
        child: Wrap(
          alignment: WrapAlignment.center, // 确保Wrap内容居中
          spacing: 5.0,
          runSpacing: 5.0,
          children: state.randomNumbers.map<Widget>((number) {

            return Container(
              //padding: EdgeInsets.all(5),
              child: Text(
                "$number",
                style: TextStyle(
                  fontSize: 300,
                  fontWeight: FontWeight.bold,
                 // color: diceColors[number] ?? state.randComArgs.value.colorPageText, // 使用骰子面颜色，如果没有匹配则使用默认颜色
                ),
              ),
            );
          }).toList(),
        ),
      ),
    ),
  ));
}

// ... 已有代码 ...






}


